home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Environments / Small Eiffel 0.4.8 / lib_rand / demo1.e next >
Text File  |  1997-04-13  |  847b  |  42 lines

  1. -- Part of SmallEiffel -- Read DISCLAIMER file -- Copyright (C) 
  2. -- Dominique COLNET and Suzanne COLLIN -- colnet@loria.fr
  3. --
  4. class DEMO1
  5.  
  6. creation make 
  7.  
  8. feature
  9.  
  10.    make is
  11.       local
  12.      std_rand: MIN_STAND;
  13.      count, range, column: INTEGER;
  14.       do
  15.      io.put_string("Using the MIN_STAND random number generator.%N%
  16.                %How many numbers ? ");
  17.      io.read_integer;
  18.      count := io.last_integer;
  19.      io.put_string("Range ( > 1)     ? ");
  20.      io.read_integer;
  21.      range := io.last_integer;
  22.      from
  23.         !!std_rand.make;
  24.      until
  25.         count = 0
  26.      loop
  27.         std_rand.next;
  28.         io.put_integer(std_rand.last_integer(range));
  29.         count := count - 1;
  30.         if column = 6 then
  31.            io.put_string("%N");
  32.            column := 0;
  33.         else
  34.            column := column + 1;
  35.            io.put_string("%T");
  36.         end;
  37.      end;
  38.      io.put_string("%N");
  39.       end;
  40.  
  41. end -- DEMO1
  42.